/**
 * ShipType.java
 *
 * Roslan's Remake of MOO in 3D using Ardor3D
 * (C) 2011 Roslan Amir. All rights reserved.
 */

package com.roslan.games.moo3d.data;

import com.roslan.games.moo3d.data.Star.Environment;

/**
 * This class represents a ship type in the game.
 * 
 * @author Roslan Amir
 * @version 1.0 - Jan 16, 2011
 */
public class ShipType {

	/**
	 * The maximum number of slots of ship designs.
	 */
	public static final int TYPE_COUNT = 6;

	/**
	 * The cost of the starting Scout design.
	 */
	public static final int INITIAL_SCOUT_COST = 8;

	/**
	 * The cost of the starting Fighter design.
	 */
	public static final int INITIAL_FIGHTER_COST = 14;

	/**
	 * The cost of the starting Destroyer design.
	 */
	public static final int INITIAL_DESTROYER_COST = 74;

	/**
	 * The cost of the starting Bomber design.
	 */
	public static final int INITIAL_BOMBER_COST = 65;

	/**
	 * The cost of the starting Colony Ship design.
	 */
	public static final int INITIAL_COLONY_SHIP_COST = 570;

	/**
	 * The starting warp speed for each player.
	 */
	public static final int INITIAL_WARP_SPEED = 1;

	/**
	 * The starting ship range for each player.
	 */
	public static final int INITIAL_SHIP_RANGE = 3;

	/**
	 * The additional range provided by reserve tanks.
	 */
	public static final int RESERVE_FUELS_RANGE = 3;

	/**
	 * The name of this ship.
	 */
	public final String name;

	/**
	 * The cost of building this ship in BC.
	 */
	public final int cost;

	/**
	 * The warp speed of this ship type.
	 */
	public final int warpSpeed;

	/**
	 * The maximum range of this ship type.
	 */
	public final int maxRange;

	/**
	 * The colonizer type for this design.
	 */
	public final Environment colonizer;

	/**
	 * Constructor.
	 * 
	 * @param name - the name to give to this ship type
	 * @param cost - the cost (in BC) for this ship type
	 * @param warpSpeed - the warp speed (parsecs per turn) for this ship type
	 * @param maxRange - the maximum range (parsecs) for this ship type
	 */
	public ShipType(String name, int cost, int warpSpeed, int maxRange) {
		super();
		this.name = name;
		this.cost = cost;
		this.warpSpeed = warpSpeed;
		this.maxRange = maxRange;
		this.colonizer = Environment.NONE;
	}

	/**
	 * Constructor.
	 * 
	 * @param name - the name to give to this ship type
	 * @param cost - the cost (in BC) for this ship type
	 * @param warpSpeed - the warp speed (parsecs per turn) for this ship type
	 * @param maxRange - the maximum range (parsecs) for this ship type
	 * @param colonizer - the colonizer type for this ship type (if any)
	 */
	public ShipType(String name, int cost, int warpSpeed, int maxRange, Environment colonizer) {
		super();
		this.name = name;
		this.cost = cost;
		this.warpSpeed = warpSpeed;
		this.maxRange = maxRange;
		this.colonizer = colonizer;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "ShipType [name=" + name + ", cost=" + cost + ", warpSpeed=" + warpSpeed + ", maxRange=" + maxRange + ']';
	}

	/**
	 * Create the initial ship designs for each race.
	 * 
	 * @param shipTypes - the array of <code>ShipType</code>s (6 slots)
	 */
	public static void createInitialShipTypes(final ShipType[] shipTypes) {
		shipTypes[0] = new ShipType("Scout", INITIAL_SCOUT_COST, INITIAL_WARP_SPEED, INITIAL_SHIP_RANGE + RESERVE_FUELS_RANGE);
		shipTypes[1] = new ShipType("Fighter", INITIAL_FIGHTER_COST, INITIAL_WARP_SPEED, INITIAL_SHIP_RANGE);
		shipTypes[2] = new ShipType("Destroyer", INITIAL_DESTROYER_COST, INITIAL_WARP_SPEED, INITIAL_SHIP_RANGE);
		shipTypes[3] = new ShipType("Bomber", INITIAL_BOMBER_COST, INITIAL_WARP_SPEED, INITIAL_SHIP_RANGE);
		shipTypes[4] = new ShipType("Colony Ship", INITIAL_COLONY_SHIP_COST, INITIAL_WARP_SPEED, INITIAL_SHIP_RANGE, Environment.MINIMAL);
		shipTypes[5] = null;
	}

}
